<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>修改密码</title>
    <script src="/bootstrap/js/jquery.min.js?v=2.1.4"></script>
    <script src="/bootstrap/js/bootstrap.min.js?v=3.3.5"></script>
    <script src="/bootstrap/js/plugins/validate/jquery.validate.min.js"></script>
    <script src="/bootstrap/js/plugins/validate/messages_zh.min.js"></script>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="/bootstrap/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="/bootstrap/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="/bootstrap/css/bootstrap.min.css" type="text/css" rel="stylesheet">
    <link href="/bootstrap/css/animate.min.css" type="text/css" rel="stylesheet">
    <link href="/bootstrap/css/login.min.css" type="text/css" rel="stylesheet">
    <link href="/bootstrap/css/style.min.css?v=4.0.0" rel="stylesheet">

    <base target="_blank">
    <script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>
    <!--[if lt IE 8]>
    <meta http-equiv="refresh" content="0;ie.html"/>
    <![endif]-->
    <script>if (window.top !== window.self) {
        window.top.location = window.location;
    }</script>

    <%--点击提交发送ajax请求--%>

    <script>
        $(function () {
            $("#save").click(function () {
                $.post(
                    "/changePassword/updatepassword",
                    {
                        newPassword: $("#newPassword").val()
                    },
                    function (data) {
                        if (data.success) {
                            $.messager.confirm("提示:", '修改成功', "info", function () {
                                window.location.href = "/main"
                            })
                        } else {
                            $.messager.alert("提示", data.msg, "error");

                        }
                    }
                )
            })
        })
    </script>
    <script>
        $(function () {
            $("#changeForm").validate({
                rules: {
                    "oldPassword": {
                        rangelength: [2, 16]
                    },
                    "newPassword": {
                        required: true,
                        minlength: 1
                    },
                    "comfirmPassword": {
                        equalTo: "#password"
                    },
                },
                messages: {
                    "oldPassword": {
                        required: "密码必填",
                        minlength: "密码不能少于1位"
                    },
                    "password": {
                        required: "密码必填",
                        minlength: "密码不能少于1位"
                    },
                    "comfirmPassword": {
                        equalTo: "两次密码不一致"
                    },
                }
            });
        });
    </script>
</head>

<body class="gray-bg">
<div class="middle-box text-center loginscreen  animated fadeInDown">
    <div>
        <div>
        </div>
        <h3 style="margin-bottom: 50px ;margin-top: 150px">欢迎使用 天河系统</h3>

        <form class="m-t" role="form" id="changeForm">
            <div class="form-group">
                <input type="text" class="form-control " placeholder="旧密码" required="" autocomplete="off"
                       id="oldPassword" name="oldPassword">
            </div>
            <div class="form-group">
                <input type="password" class="form-control" placeholder="新密码" required="" autocomplete="off"
                       id="newPassword" name="newPassword">
            </div>
            <div class="form-group">
                <input type="password" class="form-control" placeholder="请再次输入密码" required="" autocomplete="off"
                       id="comfirmPassword" name="comfirmPassword">
            </div>
            <input style="margin-bottom: 20px" type="button" class="btn btn-primary block full-width m-b" id="save"
                   value="提 &emsp;交">

            <p class="text-muted text-center">
                又忘记密码了 说明你脑子不好使 管理员都鄙视你
                </a>
            </p>

        </form>
    </div>
</div>

</body>

</html>